package cn.com.duiba.millionaire.center.biz.dao.impl;

import cn.com.duiba.millionaire.center.biz.constants.DatabaseSchema;
import cn.com.duiba.millionaire.center.biz.dao.BaseDao;
import cn.com.duiba.millionaire.center.biz.dao.MillionaireGameDao;
import cn.com.duiba.millionaire.center.biz.entity.MillionaireGameEntity;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by sunchangji on 2018/3/7.
 */
@Repository("millionaireGameDao")
public class MillionaireGameDaoImpl extends BaseDao implements MillionaireGameDao {

    @Override
    public MillionaireGameEntity gameInsert(MillionaireGameEntity millionaireGameEntity) {
        insert("gameInsert",millionaireGameEntity);
        return millionaireGameEntity;
    }

    @Override
    public int updateById(MillionaireGameEntity millionaireGameEntity) {
        return update("updateById",millionaireGameEntity);
    }

    @Override
    public MillionaireGameEntity findById(Long id) {
        return selectOne("findById",id);
    }

    @Override
    public List<MillionaireGameEntity> findByBagId(Long bagId) {
        return selectList("findByBagId",bagId);
    }

    @Override
    public int deleteById(Long id) {
        return update("deleteById",id);
    }

    @Override
    public Integer findQuestionCount(Long bagId) {
        return selectOne("findQuestionCount",bagId);
    }

    @Override
    protected DatabaseSchema chooseSchema() {
        return DatabaseSchema.MILLIONAIRE_CONFIG;
    }

}
